Dendritic spines cover dendrites of most mammalian neurons and receive almost all excitatory connections in the cortex. Although their role in these circuits is therefore likely to be crucial, the function of spines is still poorly understood. Spines are chemical compartments, and this could provide the biochemical isolation necessary to implement input-specific synaptic plasticity. But recent experiments have suggested that, in addition, spines could compartmentalize voltage. This could have a major impact on excitatory synaptic potentials, altering them as they are injected into the dendrites. In fact, by regulating the spine neck dimensions, dendritic spines could rapidly control synaptic strength. While there is in vitro data supporting this hypothesis, there is currently no direct measurements of spine voltages in vivo. Our goal is to build tools to determine if spines indeed have an electrical function in vivo. We propose two types of optical tools to image and optically manipulate spines in mouse visual cortex in vivo. In the first aim we will build, calibrate and test two novel Genetically Encoded Voltage Indicators (GEVIs), which will be designed for optimal two-photon cross section and for targeting to dendritic spines. In the second aim, we will pilot the use of simultaneous two-photon imaging and optogenetics of individual spines in vivo and we will also synthesize and test a RuBi caged-TTX for two-photon photorelease in vivo. Our research will develop tools that could enable the systematic study of the function of dendritic spines and other neuronal nanocompartments. Testing the electrical function of spines could also help to better understand the pathophysiology of many mental retardation syndromes, characterized by abnormally long spines.